package com.batata.continuing.web.billing;

import com.batata.continuing.pojo.base.ResultData;
import com.batata.continuing.pojo.billing.BillInfo;
import com.batata.continuing.pojo.billing.BillParam;
import com.batata.continuing.service.billing.BillingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.math.BigInteger;

@Api(tags = "账单相关接口")
@RestController
@RequestMapping("/billing")
public class BillingController {

    @Autowired
    private BillingService billingService;


    @ApiOperation("添加账单信息")
    @PostMapping("/addBilling")
    public ResultData<Object> addBilling(BillInfo billInfo, HttpServletRequest request) {
        return billingService.addBilling(billInfo, request);
    }

    @ApiOperation("账单列表")
    @PostMapping("/billingList")
    public ResultData<?> billingList(BillParam billParam, HttpServletRequest request) {
        return billingService.billingList(billParam, request);
    }

    @ApiOperation("删除账单")
    @ApiImplicitParam(name = "id", value = "账单id", required = true, dataType = "BigInteger")
    @PostMapping("/removeBilling")
    public ResultData<Object> removeBilling(BigInteger id, HttpServletRequest request) {
        return billingService.removeBilling(id, request);
    }


}
